package org.crl.blogsystem.repository;

import org.crl.blogsystem.entity.UserFollow;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserFollowRepository extends CrudRepository<UserFollow, Long> {
    void deleteByFollowerIdAndFollowingId(Long loginId, Long userId);
    UserFollow findByFollowerIdAndFollowingIdAndState(Long followerId, Long followingId, Integer state);
    boolean existsByFollowerIdAndFollowingIdAndState(Long followerId, Long followingId, Integer state);
    List<UserFollow> findByFollowerIdAndState(Long userId, Integer state);
    List<UserFollow> findByFollowingIdAndState(Long userId, Integer state);

    boolean existsByFollowerIdAndFollowingId(Long userId, Long loginId);

    UserFollow findByFollowerIdAndFollowingId(Long loginId, Long userId);
}
